import { BrowserRouter,Navigate,useRoutes } from 'react-router'
// import Login from '../Pages/Login'
import NoteClass from '../Pages/NoteClass'
import Register from '../Pages/Register'
import NoteList from '../Pages/NoteList'
import NoteDetail from '../Pages/NoteDetail'
import NotePublish from '../Pages/NotePublish'
import React from 'react'
const Login = React.lazy(()=>import('../Pages/Login'))
const routes = [
    {
        path:'/login',
        element:<Login />
    },
    {
        path:'/',
        element:<Navigate to='/NoteClass' />
    },
    {
        path:'/noteClass',
        element:<NoteClass />
    },
    {
        path:'/register',
        element:<Register />
    },
    {
        path:'/noteList',
        element:<NoteList />
    },
    {
        path:'/noteDetail',
        element:<NoteDetail />
    },
    {
        path:'/notePublish',
        element:<NotePublish />
    }
]
function WrapperRoutes() {
    //useRoutes这个hook函数只能用在路由组件中，也就是说，该组件不能被抛出
   let ele = useRoutes(routes)
   return ele
}


export default function WrapperRouter() {
    return (
        <BrowserRouter>
            <WrapperRoutes />
        </BrowserRouter>
    )
}
